#include <iostream>
#include <boost/asio.hpp>

using boost::asio::ip::tcp;

int main()
{
    try
    {
        boost::asio::io_context io;
        tcp::socket socket(io);

        socket.connect(tcp::endpoint(boost::asio::ip::make_address("127.0.0.1"), 12345));

        std::string msg = "Hello from client!";
        boost::asio::write(socket, boost::asio::buffer(msg));

        char reply[1024];
        size_t len = socket.read_some(boost::asio::buffer(reply));
        std::cout << "Server replied: " << std::string(reply, len) << "\n";
    }
    catch (std::exception &e)
    {
        std::cerr << "Exception: " << e.what() << "\n";
    }
}
